// reduxcer函数接收两个参数，分别为：之前的状态(preState)，动作对象(action)

const initState = 0 //初始化状态
export default function countReducer(preState = initState, action) {
    console.log(preState);
    const { type, data } = action
    switch (type) {
        case 'increment':
            return preState + data
        case 'decrement':
            return preState - data
        default:
            return preState;
    }
}